# base image
FROM centos:7.8.2003

MAINTAINER 584103210@qq.com

ADD libzip-1.3.2.tar.gz /usr/local/src

WORKDIR /usr/local/src/libzip-1.3.2
RUN ./configure && make && make install


ADD remi-release-7.7-2.el7.remi.noarch.rpm /usr/local/src
WORKDIR /usr/local/src
RUN yum -y install epel-release && rpm -ivh remi-release-7.7-2.el7.remi.noarch.rpm


ADD php-7.4.10.tar.gz /usr/local/src

RUN yum -y install libxml2 libxml2-devel bzip2 bzip2-devel libjpeg-turbo libjpeg-turbo-devel libpng libpng-devel freetype freetype-devel zlib zlib-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel  libxml2 libxml2-devel zlib zlib-devel curl curl-devel openssl openssl-devel sqlite-devel

RUN yum -y install --enablerepo=remi install oniguruma5php oniguruma5php-devel


WORKDIR /usr/local/src/php-7.4.10
RUN export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/" && ./configure  --prefix=/usr/local/php  --enable-fpm  --with-fpm-user=www  --with-fpm-group=www  --with-pdo-mysql=mysqlnd  --with-mysqli=mysqlnd  --with-zlib  --with-curl  --enable-gd   --with-jpeg=/usr  --with-freetype=/usr  --with-openssl  --enable-mbstring  --enable-xml  --enable-session  --enable-ftp  --enable-pdo -enable-tokenizer  --with-zip && make && make install


COPY php.ini-production /usr/local/php/etc/php.ini
COPY php-fpm.conf /usr/local/php/etc/php-fpm.conf
COPY www.conf /usr/local/php/etc/php-fpm.d/www.conf

RUN useradd -M -s /sbin/nologin www


EXPOSE 9000

CMD ["/usr/local/php/sbin/php-fpm"]
